﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WiiKey {
    public partial class Zoom : Form {
        public Zoom() {
            InitializeComponent();
            pboxZoom.Image = GetDesktopWindowCaptureAsBitmap();
        }

        public void ZoomIn() {
            int xWidthDelta = (int)decimal.Round(pboxZoom.Width * 0.1m);
            int xHeightDelta = (int)decimal.Round(pboxZoom.Width * 0.1m);
            pboxZoom.SetBounds(pboxZoom.Left - (int)decimal.Round(xWidthDelta / 2), pboxZoom.Top - (int)decimal.Round(xHeightDelta / 2)
                , pboxZoom.Width + xWidthDelta, pboxZoom.Height + xHeightDelta);
        }

        private void Zoom_KeyPress(object sender, KeyPressEventArgs e) {
            if (e.KeyChar == 0x1B) {
                Close();
                mZoomForm = null;
            } else if (e.KeyChar == '+') {
                ZoomIn();
            }
        }

        private void Zoom_Shown(object sender, EventArgs e) {
            pboxZoom.SetBounds(0, 0, ClientSize.Width, ClientSize.Height);
        }
    }
}
